Skip to content

Create an example to document egress policies - #94

Merged
aron-cf merged 1 commit into
mainfrom
egress-example
Aug 11, 2026
Merged

Create an example to document egress policies#94
aron-cf merged 1 commit into
mainfrom
egress-example

Conversation

@aron-cf

@aron-cf aron-cf commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Run the same HTTP request through the container shell, Worker shell,
and Worker JavaScript backends. Apply one EGRESS_MODE policy to all
three and return comparable status, MIME type, or error results.

Include blocked, direct, and allowlisted gateway modes with focused
tests and local run instructions. Pin the container runtime to Debian
bookworm so package signature verification and the FUSE 2 library
remain compatible.

EGRESS_MODE applies the same egress policy to every backend.

EGRESS_MODE Workspace policy Behavior
none { mode: "none" } Blocks outbound network access. This is the default.
all { mode: "direct" } Allows direct outbound access.
custom { mode: "http-gateway" } Routes requests through a gateway that allows only https://example.com. Other origins receive 403.

Then run the server:

npm run dev --workspace @example/computer-egress -- --var EGRESS_MODE:custom

Then send a request:

curl -X POST 'http://127.0.0.1:8787/fetch?url=https%3A%2F%2Fexample.com'

The endpoint returns the status code and MIME type from each backend, or an error when no response was available:

{
  "mode": "all",
  "url": "https://example.com/",
  "container": { "status": 200, "mimeType": "text/html" },
  "worker-shell": { "status": 200, "mimeType": "text/html" },
  "worker-javascript": { "status": 200, "mimeType": "text/html" }
}

Run the same HTTP request through the container shell, Worker shell,
and Worker JavaScript backends. Apply one EGRESS_MODE policy to all
three and return comparable status, MIME type, or error results.

Include blocked, direct, and allowlisted gateway modes with focused
tests and local run instructions. Pin the container runtime to Debian
bookworm so package signature verification and the FUSE 2 library
remain compatible.
@changeset-bot

changeset-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 45a0168

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Aug 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@cloudflare/computer@94

commit: 45a0168

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@aron-cf
aron-cf merged commit 7dbcd8b into main Aug 11, 2026
19 checks passed
@aron-cf
aron-cf deleted the egress-example branch August 11, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant